package two;

// 1. 修改导入语句，使用 JUnit 4 的包
import org.junit.Test;
import static org.junit.Assert.*;

public class ExpressionUnitTestV2 {

    // 2. 将 @Test 注解改为 JUnit 4 的版本
    @Test
    public void testAddExpression() {
        AbstractExpression expr = new AddExpression(3, 5);
        assertEquals(8, expr.getResult());
        assertEquals("3 + 5 = 8", expr.toString());
    }

    @Test
    public void testSubtractExpression() {
        AbstractExpression expr = new SubtractExpression(3, 5);
        assertEquals(2, expr.getResult());
        assertEquals("5 - 3 = 2", expr.toString());
    }

    @Test
    public void testDivideExpression() {
        AbstractExpression expr = new DivideExpression(4, 12);
        assertEquals(3, expr.getResult());
        assertEquals("12 / 4 = 3", expr.toString());
    }
}